/*

* ------------------------------------------------------------------------
* ------------------------------------------------------------------------
* |     Smart-Shop开源商城系统/ Java商城-首选电商平台系统 请务必保留此注释头信息
* |     开源地址: https://gitee.com/ningbo-qishan/gruul-mall
* ------------------------------------------------------------------------
* ------------------------------------------------------------------------
* |     可正常分享和学习源码,未经授权 不可商用！
* |     商业版中台购买/开源版商业授权 联系技术客服
* |     官网:  https://www.73app.cn/
* ------------------------------------------------------------------------
* ------------------------------------------------------------------------
* |     Copyright (c) 2016-2999 宁波启山智软科技有限公司
* |     版权所有 ,侵权必究！
* ------------------------------------------------------------------------

*/
package com.medusa.gruul.account.api.feign;

import com.medusa.gruul.account.api.model.*;
import com.medusa.gruul.common.core.util.Result;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;


/**
 * @author whh
 * @date 2019/11/06
 */
@FeignClient(value = "account")
public interface RemoteMiniAccountService {


    /**
     * 修改用户扩展字段部分数据
     *
     * @param userId                      用户id
     * @param miniAccountExtendsUpdateDto com.medusa.gruul.account.api.model.MiniAccountExtendsUpdateDto
     * @return java.lang.Boolean  修改成功->true   失败->false
     */
    @RequestMapping(value = "/portion/attribute/modify/{userId}", method = RequestMethod.POST)
    @ApiOperation(value = "修改用户扩展字段部分数据")
    Boolean portionAttributeModify(@PathVariable(value = "userId", required = true) @NotNull(message = "用户id不能为null") String userId,
                                   @RequestBody @NotNull(message = "修改数据不能为null") MiniAccountExtendsUpdateDto miniAccountExtendsUpdateDto);

    /**
     * 获取用户信息接口
     *
     * @param userId 用户id
     * @param infos  [1,2,3,4]  1,基本信息,2,扩展信息,3-地址信息,4-授权信息 5-用户所属团长信息  需要哪些发哪些 list
     * @return com.medusa.gruul.account.api.model.AccountInfoDto
     */
    @RequestMapping(value = "/account/info/{userId}", method = RequestMethod.GET)
    @ApiOperation(value = "获取用户信息,注意判空")
    AccountInfoDto accountInfo(@PathVariable(value = "userId", required = true) @NotNull(message = "用户id不能为null") String userId,
                               @RequestParam(value = "infos", required = true) @NotNull(message = "获取数据数组不能为空") List<Integer> infos);

    /**
     * 批量获取指定用户id(用户店铺id)的用户基本信息
     *
     * @param shopUserId 用户id数组
     * @return com.medusa.gruul.account.api.model.AccountInfoDto
     */
    @RequestMapping(value = "/accounts/info", method = RequestMethod.GET)
    @ApiOperation(value = "批量获取指定用户id(用户店铺id)的用户基本信息")
    List<MiniAccountExtDto> accountsInfoList(@RequestParam(value = "shopUserId") @NotNull(message = "用户id不能为null") List<String> shopUserId);


    /**
     * 获取多个指定团长下用户
     *
     * @param areaUserId     团长id
     * @param page           页数
     * @param size           条数
     * @param nikeName       昵称
     * @param registerTimeGt 注册开始时间 2020-04-10 21:26:35
     * @param registerTimeLt 注册结束时间 2020-04-27 15:54:08
     * @return com.medusa.gruul.account.model.dto.AreaAccountInfoDto
     */
    @RequestMapping(value = "/area/info", method = RequestMethod.GET)
    @ApiOperation(value = "获取多个指定团长下用户")
    PageDto<AreaAccountInfoDto> areaAccountInfo(
            @RequestParam(value = "areaUserId") @NotNull(message = "团长id数组") List<String> areaUserId,
            @RequestParam(value = "page", defaultValue = "1") @NotNull(message = "页数不能为空") Integer page,
            @RequestParam(value = "size", defaultValue = "10") @NotNull(message = "条数不能为空") Integer size,
            @RequestParam(value = "nikeName", required = false) String nikeName,
            @RequestParam(value = "registerTimeGt", required = false) String registerTimeGt,
            @RequestParam(value = "registerTimeLt", required = false) String registerTimeLt);


    /**
     * 获取多个指定团长下的用户数量
     *
     * @param areaUserId 团长id
     * @return 团长id, 用户数量
     */
    @RequestMapping(value = "/area/count", method = RequestMethod.GET)
    @ApiOperation(value = "获取多个指定团长下的用户数量")
    Map<Long, Integer> areaAccountCount(
            @RequestParam(value = "areaUserId") @NotNull(message = "团长id数组") List<String> areaUserId
    );

    /**
     * 积分确认是否足够或直接确认减少接口
     *
     * @param userId   用户id
     * @param value    要减少的积分值
     * @param isDeduct 是否直接减少 true 直接减少  false不操作积分,只确认积分是否足够
     * @return 情况1:  isDeduct == true && 减少积分足够 return true   直接扣减并且积分足够
     * 情况2:  isDeduct == false && 减少积分足够 return true  不扣减仅确认积分是否足够
     */
    @RequestMapping(value = "/integral/subtract/affirm/{userId}", method = RequestMethod.GET)
    @ApiOperation(value = "获取用户信息,注意判空")
    Boolean integralSubtractAffirm(@PathVariable(value = "userId", required = true) @NotNull(message = "用户id不能为null") String userId,
                                   @RequestParam(value = "value", required = true) @NotNull(message = "积分值不能为空") BigDecimal value,
                                   @RequestParam(value = "isDeduct", required = true) @NotNull(message = "是否直接扣除字段不能为null") Boolean isDeduct);


    /**
     * 根据shopUserId获取团长相关信息
     *
     * @param shopUserId 店铺用户id
     * @return com.medusa.gruul.account.api.model.UserSharerVo
     */
    @RequestMapping(value = "/{shopUserId}", method = RequestMethod.GET)
    @ApiOperation(value = "根据shopUserId获取团长相关信息")
    UserSharerVo getCommanderInfo(@PathVariable(value = "shopUserId") String shopUserId);

    /**
     * 根据租户id和用户id获取会员信息
     *
     * @param tenantId 租户id
     * @param userId   用户id
     * @return com.medusa.gruul.account.api.model.MemberCardInfoCenterDto
     */
    @RequestMapping(value = "/remote/getMemberInfo", method = RequestMethod.GET)
    @ApiOperation(value = "用户id不能为null")
    MemberCardInfoCenterDto getMemberInfo(@RequestParam(value = "tenantId") @NotNull(message = "租户id不能为null") String tenantId,
                                          @RequestParam(value = "userId") @NotNull(message = "用户id不能为null") String userId);

    /**
     * 获取租户id下最高等级的会员等级信息
     *
     * @param tenantId 租户id
     * @return com.medusa.gruul.account.api.model.MemberCardInfoCenterDto
     */
    @RequestMapping(value = "/remote/getTopMemberCardInfo", method = RequestMethod.GET)
    @ApiOperation(value = "租户id不能为null")
    MemberTopCardInfoDto getTopMemberCardInfo(@RequestParam(value = "tenantId") @NotNull(message = "租户id不能为null") String tenantId);

    /**
     * 扣除余额且插入余额明细表
     *
     * @param memberBalanceUpdateDto com.medusa.gruul.account.api.model.MemberBalanceUpdateDto
     * @return java.lang.Boolean  修改成功->true   失败->false
     */
    @RequestMapping(value = "/remote/memberBalanceModify", method = RequestMethod.POST)
    @ApiOperation(value = "扣除余额且插入余额明细表")
    Boolean memberBalanceModify(@RequestBody @NotNull(message = "修改数据不能为null") MemberBalanceUpdateDto memberBalanceUpdateDto);

    /**
     * 会员模块是否开启
     *
     * @param tenantId 租户id
     * @return java.lang.Integer  开关状态：0-关 1-开
     */
    @RequestMapping(value = "/remote/memberSwitch", method = RequestMethod.GET)
    @ApiOperation(value = "会员模块是否开启")
    Integer memberSwitch(@RequestParam(value = "tenantId") @NotNull(message = "租户id不能为null") String tenantId);

    /**
     * 公众号授权登录,返回登录token
     *
     * @param wxMpUserDto com.medusa.gruul.platform.api.model.dto.WxMpUserDto
     * @return java.lang.String
     */
    @RequestMapping(value = "/mp/login", method = RequestMethod.POST)
    @ApiOperation(value = "公众号授权登录")
    Result mpLogin(WxMpUserDto wxMpUserDto);

    /**
     * 根据租户id和用户id获取对应的分销员信息
     *
     * @param tenantId  租户id
     * @param userId  用户id
     * @return com.medusa.gruul.account.api.model.UserDistributionVo
     */
    @RequestMapping(value = "/remote/getDistributionInfo", method = RequestMethod.GET)
    @ApiOperation(value = "用户id不能为null")
    UserOrderDistributionVo getDistributionInfo(@RequestParam(value = "tenantId") @NotNull(message = "租户id不能为null") String tenantId,
                                          @RequestParam(value = "userId") @NotNull(message = "用户id不能为null") String userId);

}
